import { useI18n } from "vue-i18n";
import { computed } from "vue";
import { setLanguageCode } from "@/modules/auth";

export default () => {
  const { t, locale } = useI18n();
  const toggleLocale = (lang) => {
    locale.value = lang
    setLanguageCode(locale.value)
  };

  const language = computed(() => (locale.value === "zh" ? "zh" : "en"));

  return { t, language, toggleLocale };
};
